package bb.lanxing.lib.devices.sync;

import com.garmin.fit.ActivityMesg;
import com.garmin.fit.EventMesg;
import com.garmin.fit.Mesg;
import com.garmin.fit.RecordMesg;
import com.garmin.fit.SessionMesg;
import com.garmin.fit.ZonesTargetMesg;

abstract class BaseFitProcessor implements FitProcessor {
    protected abstract void onActivityMesg(ActivityMesg activityMesg);

    protected abstract void onEventMesg(EventMesg eventMesg);

    protected abstract void onRecordMesg(RecordMesg recordMesg);

    protected abstract void onSessionMesg(SessionMesg sessionMesg);

    protected abstract void onZonesTargetMesg(ZonesTargetMesg zonesTargetMesg);

    BaseFitProcessor() {
    }

    @Override
    public final void onMesg(Mesg mesg) {
        int num = mesg.getNum();
        if (num == 7) {
            onZonesTargetMesg(new ZonesTargetMesg(mesg));
        } else if (num == 18) {
            onSessionMesg(new SessionMesg(mesg));
        } else if (num == 34) {
            onActivityMesg(new ActivityMesg(mesg));
        } else if (num == 20) {
            onRecordMesg(new RecordMesg(mesg));
        } else if (num != 21) {
        } else {
            onEventMesg(new EventMesg(mesg));
        }
    }
}
